//
// USkeleton.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CVector;

public class USkeleton {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public USkeleton(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(USkeleton obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_USkeleton(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public boolean bindSkin(UInstance mi) {
    return nel3dJNI.USkeleton_bindSkin(swigCPtr, this, UInstance.getCPtr(mi), mi);
  }

  public void stickObject(UTransform mi, long boneId) {
    nel3dJNI.USkeleton_stickObject(swigCPtr, this, UTransform.getCPtr(mi), mi, boneId);
  }

  public void stickObjectEx(UTransform mi, long boneId, boolean forceCLod) {
    nel3dJNI.USkeleton_stickObjectEx(swigCPtr, this, UTransform.getCPtr(mi), mi, boneId, forceCLod);
  }

  public void detachSkeletonSon(UTransform mi) {
    nel3dJNI.USkeleton_detachSkeletonSon(swigCPtr, this, UTransform.getCPtr(mi), mi);
  }

  public void getStickedObjects(SWIGTYPE_p_std__vectorT_NL3D__UTransform_t sticks) {
    nel3dJNI.USkeleton_getStickedObjects(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__UTransform_t.getCPtr(sticks));
  }

  public long getNumBones() {
    return nel3dJNI.USkeleton_getNumBones(swigCPtr, this);
  }

  public UBone getBone(long boneId) {
    return new UBone(nel3dJNI.USkeleton_getBone(swigCPtr, this, boneId), true);
  }

  public int getBoneIdByName(String boneName) {
    return nel3dJNI.USkeleton_getBoneIdByName(swigCPtr, this, boneName);
  }

  public boolean isBoneComputed(long boneId) {
    return nel3dJNI.USkeleton_isBoneComputed(swigCPtr, this, boneId);
  }

  public boolean forceComputeBone(long boneId) {
    return nel3dJNI.USkeleton_forceComputeBone(swigCPtr, this, boneId);
  }

  public long getNumBoneComputed() {
    return nel3dJNI.USkeleton_getNumBoneComputed(swigCPtr, this);
  }

  public void setInterpolationDistance(float dist) {
    nel3dJNI.USkeleton_setInterpolationDistance(swigCPtr, this, dist);
  }

  public float getInterpolationDistance() {
    return nel3dJNI.USkeleton_getInterpolationDistance(swigCPtr, this);
  }

  public void setShapeDistMax(float distMax) {
    nel3dJNI.USkeleton_setShapeDistMax(swigCPtr, this, distMax);
  }

  public float getShapeDistMax() {
    return nel3dJNI.USkeleton_getShapeDistMax(swigCPtr, this);
  }

  public void changeMRMDistanceSetup(float distanceFinest, float distanceMiddle, float distanceCoarsest) {
    nel3dJNI.USkeleton_changeMRMDistanceSetup(swigCPtr, this, distanceFinest, distanceMiddle, distanceCoarsest);
  }

  public void setLodCharacterShape(int shapeId) {
    nel3dJNI.USkeleton_setLodCharacterShape(swigCPtr, this, shapeId);
  }

  public int getLodCharacterShape() {
    return nel3dJNI.USkeleton_getLodCharacterShape(swigCPtr, this);
  }

  public void enableLOD(boolean isEnable) {
    nel3dJNI.USkeleton_enableLOD(swigCPtr, this, isEnable);
  }

  public void setLodCharacterAnimId(long animId) {
    nel3dJNI.USkeleton_setLodCharacterAnimId(swigCPtr, this, animId);
  }

  public long getLodCharacterAnimId() {
    return nel3dJNI.USkeleton_getLodCharacterAnimId(swigCPtr, this);
  }

  public void setLodCharacterAnimTime(double time) {
    nel3dJNI.USkeleton_setLodCharacterAnimTime(swigCPtr, this, time);
  }

  public double getLodCharacterAnimTime() {
    return nel3dJNI.USkeleton_getLodCharacterAnimTime(swigCPtr, this);
  }

  public void setLodCharacterWrapMode(boolean wrapMode) {
    nel3dJNI.USkeleton_setLodCharacterWrapMode(swigCPtr, this, wrapMode);
  }

  public boolean getLodCharacterWrapMode() {
    return nel3dJNI.USkeleton_getLodCharacterWrapMode(swigCPtr, this);
  }

  public boolean isDisplayedAsLodCharacter() {
    return nel3dJNI.USkeleton_isDisplayedAsLodCharacter(swigCPtr, this);
  }

  public void setLodCharacterDistance(float dist) {
    nel3dJNI.USkeleton_setLodCharacterDistance(swigCPtr, this, dist);
  }

  public float getLodCharacterDistance() {
    return nel3dJNI.USkeleton_getLodCharacterDistance(swigCPtr, this);
  }

  public void computeLodTexture() {
    nel3dJNI.USkeleton_computeLodTexture(swigCPtr, this);
  }

  public void setLodEmit(CRGBA emit) {
    nel3dJNI.USkeleton_setLodEmit(swigCPtr, this, CRGBA.getCPtr(emit), emit);
  }

  public CRGBA getLodEmit() {
    return new CRGBA(nel3dJNI.USkeleton_getLodEmit(swigCPtr, this), true);
  }

  public boolean computeRenderedBBox(SWIGTYPE_p_NLMISC__CAABBox bbox, boolean computeInWorld) {
    return nel3dJNI.USkeleton_computeRenderedBBox__SWIG_0(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox), computeInWorld);
  }

  public boolean computeRenderedBBox(SWIGTYPE_p_NLMISC__CAABBox bbox) {
    return nel3dJNI.USkeleton_computeRenderedBBox__SWIG_1(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox));
  }

  public boolean computeRenderedBBoxWithBoneSphere(SWIGTYPE_p_NLMISC__CAABBox bbox, boolean computeInWorld) {
    return nel3dJNI.USkeleton_computeRenderedBBoxWithBoneSphere__SWIG_0(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox), computeInWorld);
  }

  public boolean computeRenderedBBoxWithBoneSphere(SWIGTYPE_p_NLMISC__CAABBox bbox) {
    return nel3dJNI.USkeleton_computeRenderedBBoxWithBoneSphere__SWIG_1(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox));
  }

  public boolean computeCurrentBBox(SWIGTYPE_p_NLMISC__CAABBox bbox, UPlayList playList, double playTime, boolean forceCompute, boolean computeInWorld) {
    return nel3dJNI.USkeleton_computeCurrentBBox__SWIG_0(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox), UPlayList.getCPtr(playList), playList, playTime, forceCompute, computeInWorld);
  }

  public boolean computeCurrentBBox(SWIGTYPE_p_NLMISC__CAABBox bbox, UPlayList playList, double playTime, boolean forceCompute) {
    return nel3dJNI.USkeleton_computeCurrentBBox__SWIG_1(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox), UPlayList.getCPtr(playList), playList, playTime, forceCompute);
  }

  public boolean computeCurrentBBox(SWIGTYPE_p_NLMISC__CAABBox bbox, UPlayList playList, double playTime) {
    return nel3dJNI.USkeleton_computeCurrentBBox__SWIG_2(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox), UPlayList.getCPtr(playList), playList, playTime);
  }

  public boolean computeCurrentBBox(SWIGTYPE_p_NLMISC__CAABBox bbox, UPlayList playList) {
    return nel3dJNI.USkeleton_computeCurrentBBox__SWIG_3(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox), UPlayList.getCPtr(playList), playList);
  }

  public void setSSSWOPos(CVector pos) {
    nel3dJNI.USkeleton_setSSSWOPos(swigCPtr, this, CVector.getCPtr(pos), pos);
  }

  public CVector getSSSWOPos() {
    return new CVector(nel3dJNI.USkeleton_getSSSWOPos(swigCPtr, this), false);
  }

  public void setSSSWODir(CVector dir) {
    nel3dJNI.USkeleton_setSSSWODir(swigCPtr, this, CVector.getCPtr(dir), dir);
  }

  public CVector getSSSWODir() {
    return new CVector(nel3dJNI.USkeleton_getSSSWODir(swigCPtr, this), false);
  }

  public String getShapeName() {
    return nel3dJNI.USkeleton_getShapeName(swigCPtr, this);
  }

  public void setBoneAnimCtrl(long boneId, IAnimCtrl ctrl) {
    nel3dJNI.USkeleton_setBoneAnimCtrl(swigCPtr, this, boneId, IAnimCtrl.getCPtr(ctrl), ctrl);
  }

  public IAnimCtrl getBoneAnimCtrl(long boneId) {
    long cPtr = nel3dJNI.USkeleton_getBoneAnimCtrl(swigCPtr, this, boneId);
    return (cPtr == 0) ? null : new IAnimCtrl(cPtr, false);
  }

  public void cast(UTransform object) {
    nel3dJNI.USkeleton_cast(swigCPtr, this, UTransform.getCPtr(object), object);
  }

  public USkeleton() {
    this(nel3dJNI.new_USkeleton__SWIG_0(), true);
  }

  public USkeleton(CSkeletonModel object) {
    this(nel3dJNI.new_USkeleton__SWIG_1(CSkeletonModel.getCPtr(object), object), true);
  }

  public void attach(CSkeletonModel object) {
    nel3dJNI.USkeleton_attach(swigCPtr, this, CSkeletonModel.getCPtr(object), object);
  }

  public void detach() {
    nel3dJNI.USkeleton_detach(swigCPtr, this);
  }

  public boolean empty() {
    return nel3dJNI.USkeleton_empty(swigCPtr, this);
  }

  public CSkeletonModel getObjectPtr() {
    long cPtr = nel3dJNI.USkeleton_getObjectPtr(swigCPtr, this);
    return (cPtr == 0) ? null : new CSkeletonModel(cPtr, false);
  }

}
